import datetime
import time
import math
import sys

class MathBenchmark:
    @staticmethod
    def startCheck(biggerP:int=10, autoBigger:bool=True, disableLogger:bool=True) -> int:
        startBenchmarkTime:tuple = (datetime.datetime.now().minute, datetime.datetime.now().second)
        stopScore:int = 0; calcCount = 0
        while True:
            seed:int = int(time.time())
            math.sqrt(seed); calcCount += 1

            # ---> Stop benchmark test
            stopBenchmarkTime: tuple = (datetime.datetime.now().minute, datetime.datetime.now().second)
            if stopBenchmarkTime[1] < startBenchmarkTime[1]:
                if stopBenchmarkTime[0] > startBenchmarkTime[0]:
                    break
            if stopBenchmarkTime[1] > startBenchmarkTime[1]:
                break

            if disableLogger: print(f"(Log)[Bench] Math benchmark calc amount: {calcCount}... ")

        # ---> Calc score
        if disableLogger: print("(Log)[Bench] Math benchmark Completed! Calc score... ")
        if autoBigger: stopScore += int(calcCount * biggerP)
        else: stopScore += int(calcCount)
        return stopScore


# --> Compile script
if __name__ == '__main__':
    # # # # # # # # # # # #  Compile Args  # # # # # # # # # # # # #
    # ---------- Args: [<biggerPoint>] [<disableLogger>] ----------

    if sys.argv[2] == "enable": LOGGER_STATUS = True
    elif sys.argv[2] == "disable": LOGGER_STATUS = False
    else: sys.exit()
    print(f"(Res)[Completed] Score is: {MathBenchmark.startCheck(int(sys.argv[1]), disableLogger=LOGGER_STATUS)}")